 
/* 
 * Copyright (C) Ignacio Lucas
 */
 
/*
 *  user_util, hecho por Ignacio Lucas
 *
 *  Utilidades para el constructor de aplicaciones.
 *
 *  Ignacio Lucas <ignacio.lucas@gmail.com>
 */

#include "user_util.h"
#include "worker.h"


// obtencion de la tarea actualmente en ejecucion.
inline server_worker_job_t user_util_get_current_job(void)
{
	return worker_get_user_data();
}

inline void * user_util_get_user_data(void)
{
	server_worker_job_t current_job = user_util_get_current_job();
	void *ret = NULL;
	if (current_job != NULL)
	{
		ret = server_worker_job_get_user_data(current_job);
	}
	return ret;
}

inline int user_util_set_user_data(void *user_data)
{
	server_worker_job_t current_job = user_util_get_current_job();
	if (current_job != NULL)
	{
		server_worker_job_set_user_data(current_job, user_data);
		return 0;
	}
	return 1;
}


